import tkinter as tk
import win32gui
import win32con


def submit_text():
    input_text = text_entry.get()
    print(f"你输入的内容是: {input_text}")

def set_topmost():
    hwnd = win32gui.FindWindow(None, root.title())
    win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)

root = tk.Tk()
root.after(100, set_topmost)

# 创建一个文本输入框
text_entry = tk.Entry(root)
text_entry.pack()

# 绑定<Return>事件到submit_text函数
text_entry.bind('<Return>', lambda event: submit_text())

root.mainloop()